//各个模块下reducer的模版
import * as types from '../action-types'
/* Vote 模块下的reducer */
const initial = {
    supNum:10,
    oppNum:5,
    num:0
};
export default function voteReducer(state = initial, action) {
    state = { ...state };

    switch (action.type) {
        //不要自己单独写字符串值了，而是把action-types中统一管理的标识拿来进行判断！！特点：写的时候还有提示，不容易出错！！ 
        //统一管理派发的行为标识，除了保证不冲突，还能避免程序猿粗心大意，导致的错误！！
        case types.VOTE_SUP:
            state.supNum++;
            break;
        case types.VOTE_OPP:
            state.oppNum++;
            break;
        default:
    }

    return state;
}